/************************************************************************/
/*
 * Author:    $username$
 * Create on: $time$
 */
/************************************************************************/

#pragma once
#include "resource.h"

// include the MZFC library header file
#include <mzfc_inc.h>

// ID of the button in the window
#define MZ_IDC_TESTBTN1  101

// Main window derived from CMzWndEx
class C[!output PROJECT_NAME]MainWnd: public CMzWndEx
{
  MZ_DECLARE_DYNAMIC(C[!output PROJECT_NAME]MainWnd);
public:
  // A button control in the window
  UiButton m_btn;

protected:
  // Initialization of the window (dialog)
  virtual BOOL OnInitDialog()
  {
    // Must all the Init of parent class first!
    if (!CMzWndEx::OnInitDialog())
    {
      return FALSE;
    }

	// Then init the controls & other things in the window
    m_btn.SetButtonType(MZC_BUTTON_GREEN);
    m_btn.SetPos(100,250,280,100);
    m_btn.SetID(MZ_IDC_TESTBTN1);
    m_btn.SetText(L"Hello MZFC!");
    m_btn.SetTextColor(RGB(255,255,255));

	// Add the control into the window.
    AddUiWin(&m_btn);

    return TRUE;
  }

  // override the MZFC command handler
  virtual void OnMzCommand(WPARAM wParam, LPARAM lParam)
  {
    UINT_PTR id = LOWORD(wParam);
    switch(id)
    {
    case MZ_IDC_TESTBTN1:
      {
        if(1 == MzMessageBoxEx(m_hWnd, L"You have pressed Exit button, Really want exit?", L"Exit", MB_YESNO, false))
          PostQuitMessage(0);
      }
      break;
    }
  }
};
